package com.xr.common.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class MailPatternMatchUtil {

	/**
	 * 验证输入的邮箱格式是否符合
	 * @param email 待校验格式的邮箱
	 * @return boolean
	 */
	public static boolean isMatchedOrNot(String email) {
		Pattern pattern = Pattern.compile("^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(.[a-zA-Z0-9_-]+)+$");
		boolean flag = false;
		if (null != email) {
			Matcher matcher = pattern.matcher(email);
			flag = matcher.matches();
		}
		return flag;
	}

	public static void main(String[] args) {
		boolean flag = isMatchedOrNot("e_341877120_mail@163.com");
		System.out.println(flag);
	}

}
